﻿using System;
using System.Data;
using System.Linq;
namespace WPFExcelReport
{
    public partial class ITXEXRPT
    {

        private void JLTAB50DOC()
        {
            string value = "";
            DataRow dwABP = null;
            DataTable dtABF = dsSource.Tables["ABFOLGE"];
            dwABP = dsSource.Tables["ABPOS"].Rows[0];
            string SRC = "";
            exAgent.SetCellValue(6, 30, date);
            SRC = dwABP["ORD"].ToString().Trim();
            exAgent.SetCellValue(1, 23, SRC);
            SRC = dwABP["ABKKDAUFTNR"].ToString().Trim();
            exAgent.SetCellValue(6, 5, SRC);
            SRC = dwABP["TYP"].ToString();
            exAgent.SetCellValue(6, 11, Helpers.Helper.GetGB2312Value(SRC).Trim());
            SRC = dwABP["GSCBEZ"].ToString();
            exAgent.SetCellValue(6, 19, Helpers.Helper.GetGB2312Value(SRC).Trim());
            SRC = Helpers.Helper.GetGB2312Value( dwABP["GSGARNBEZ"].ToString().Trim());
            exAgent.SetCellValue(7, 5, SRC);
            SRC = dwABP["ABPFARBE"].ToString().Trim();
            exAgent.SetCellValue(7, 19, SRC);
            SRC = dwABP["ORDERNO"].ToString().Trim();
            exAgent.SetCellValue(7, 30, SRC);
            SRC = Helpers.Helper.GetGB2312Value(dwABP["GSHANDLNR"].ToString().Trim());
            exAgent.SetCellValue(8, 5, SRC);
            SRC = dwABP["QTY"].ToString().Trim();
            exAgent.SetCellValue(9, 5, System.Convert.ToDecimal(SRC));
            SRC = dwABP["BOBIN"].ToString().Trim();
            exAgent.SetCellValue(9, 19, System.Convert.ToDecimal(SRC));
            SRC = dwABP["MACHINE"].ToString().Trim();
            exAgent.SetCellValue(9, 30, SRC);
            SRC = dwABP["METH"].ToString();
            exAgent.SetCellValue(10, 5, Helpers.Helper.GetGB2312Value(SRC).Trim());
            SRC = dwABP["FIN"].ToString();
            exAgent.SetCellValue(10, 14, Helpers.Helper.GetGB2312Value(SRC).Trim());
            SRC = dwABP["BM"].ToString();
            exAgent.SetCellValue(10, 30, Helpers.Helper.GetGB2312Value(SRC).Trim());
            SRC = dwABP["REMARK"].ToString();
            exAgent.SetCellValue(14, 1, Helpers.Helper.GetGB2312Value(SRC).Trim());
            SRC = dwABP["SPART"].ToString();
            exAgent.SetCellValue(14, 26, Helpers.Helper.GetGB2312Value(SRC).Trim());

            int x =20 ;
            foreach (DataRow dwABF in dtABF.Rows)
            {
                
                SRC = dwABF["STEP"].ToString().Trim().PadRight(6);
                exAgent.SetCellValue(x, 1, SRC);
                SRC = dwABF["ABFBZAGANG"].ToString();
                exAgent.SetCellValue(x, 10, Helpers.Helper.GetGB2312Value(SRC).Trim());
                exAgent.SetCellValue(x+1,1,"1");
                x = x + 2;

            }
            
     
        } 
    }
}